home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / pcboard / cbfree13.zip / PHONE101.ZIP / PHONE.PPS < prev   
Text File  |  1996-05-19  |  7KB  |  233 lines

  1. ;    PHONE.PPE - Written by Dan Shore - April 19, 1996
  2. ;
  3. ;    Get telephone information from user record.  If phone information
  4. ;    is blank or is not in the xxx-xxx-xxxx format, the user will
  5. ;    be REQUIRED to change it.  This "proper" format will be then
  6. ;    used by CB-FREE for a callback number.
  7. ;
  8. ;────────────────────────────────────────────────────────────────────────
  9. ;
  10. ;   Installation:
  11. ;   ────────────
  12. ;
  13. ;   Use your Security Specific files to run this PPE.
  14. ;
  15. ;   In PCBSETUP:
  16. ;
  17. ;       File Location/System Files & Dir/Location of Login Security Files
  18. ;
  19. ;   Inside the Security Specific file you would have the entry:
  20. ;
  21. ;       !c:\pcb\ppe\phone\phone.ppe 100
  22. ;
  23. ;   The second parameter is the security level to bypass the PPE.  Any
  24. ;   security level greater than or equal to this level is exempt from
  25. ;   this PPE.
  26. ;
  27. ;────────────────────────────────────────────────────────────────────────
  28. STRING user_input                ' Generic user input
  29. STRING user_choice               ' User choice for editing information
  30. STRING main_prompt               ' Generic INPUTSTR prompt
  31. STRING a1                        ' Data Phone
  32. STRING a2                        ' Home Phone
  33. STRING key                       ' Get keystrokes from user
  34.  
  35. INT count                        ' Counts keystrokes from user
  36.  
  37. BOOLEAN editing_info             ' Flag for when user is editing
  38. ;────────────────────────────────────────────────────────────────────────
  39.  
  40. '
  41. '  Run PPE only if in conference 0 - Main
  42. '
  43. IF (CURCONF() = 0) THEN
  44.  
  45.   '
  46.   '  Get user record information
  47.   '
  48.   GETUSER
  49.  
  50.   '
  51.   '  Get the users address information
  52.   '
  53.   a1 = TRIM(U_BDPHONE," ")
  54.   a2 = TRIM(U_HVPHONE," ")
  55.  
  56.   GOSUB CHECK_GET_INFO
  57.  
  58. END IF
  59. END
  60.  
  61.  
  62. '
  63. '  Check phone number and get user input
  64. '
  65. :CHECK_GET_INFO
  66.  
  67.    '
  68.    '  Check to see if phone info is blank, invalid format, or too short
  69.    '
  70.    '  If information is OK, the PPE will just exit.
  71.    '
  72.    IF (a1 = "" || a2 = "" || editing_info \
  73.        || LEN(a1) < 12 || MID(a1,4,1) != "-" || MID(a1,8,1) != "-" \
  74.        || LEN(a2) < 12 || MID(a2,4,1) != "-" || MID(a2,8,1) != "-") THEN
  75.  
  76.      '
  77.      '  If too short or invalid set variable to blank
  78.      '
  79.      IF (LEN(a1) < 12 || MID(a1,4,1) != "-" || MID(a1,8,1) != "-") a1 = ""
  80.      IF (LEN(a2) < 12 || MID(a2,4,1) != "-" || MID(a2,8,1) != "-") a2 = ""
  81.  
  82.      '
  83.      '  Display notice only once
  84.      '
  85.      if (!editing_info) GOSUB DISPLAY_NOTICE
  86.      editing_info = TRUE
  87.  
  88.      '
  89.      '  Make choice for user on field to edit.  If all fields are
  90.      '  filled, ask user to make a selection.
  91.      '
  92.      IF (a1 = "") THEN
  93.        user_input = "1"
  94.      ELSEIF (a2 = "") THEN
  95.        user_input = "2"
  96.      ELSE
  97.        '
  98.        '  Display seperator and prompt
  99.        '
  100.        NEWLINE
  101.        PRINTLN "@X0F*@X0D──────────────────────────────────────────────────────────────────@X0F*"
  102.        NEWLINE
  103.        PRINTLN "  @X0FHere are your current Data/Business and Home/Voice Phone Numbers"
  104.        NEWLINE
  105.  
  106.        '
  107.        '  Display current phone information
  108.        '
  109.        PRINTLN "  @X0A      Data Phone Number @X0F= @X0E", a1
  110.        PRINTLN "  @X0AHome/Voice Phone Number @X0F= @X0E", a2
  111.  
  112.        '
  113.        '  Display Menu and get selection from user
  114.        '
  115.        user_input = ""
  116.        NEWLINE
  117.        PRINTLN "  @X0F1 - @X0DEdit Data/Business Phone Number@X07"
  118.        PRINTLN "  @X0F2 - @X0DEdit Home/Voice Phone Number@X07"
  119.        PRINTLN "  @X0F3 - @X0BExit and Save Phone Information@X07"
  120.        NEWLINE
  121.        main_prompt = "  @X0EPress [@X0F1@X0E], [@X0F2@X0E], or [@X0F3@X0E] as your selection"
  122.        INPUTSTR main_prompt, user_input, @X0E, 1, "123", LFAFTER+UPCASE+FIELDLEN+GUIDE
  123.      END IF
  124.      user_choice = user_input
  125.      '
  126.      '  Process selection (1, 2 or 3)
  127.      '
  128.      GOSUB SELECT_SECTION
  129.      '
  130.    ELSE
  131.  
  132.      '
  133.      '  Phone information is fine, exit the PPE
  134.      '
  135.      END
  136.      '
  137.    END IF
  138.  
  139.    '
  140.    '  Loop back up to top of subroutine
  141.    '
  142.    GOTO CHECK_GET_INFO
  143.  
  144. '
  145. '  Edit information based on users choice
  146. '
  147. :SELECT_SECTION
  148.  
  149.      user_input = ""
  150.      NEWLINE
  151.      SELECT CASE (user_choice)
  152.        '
  153.        '  Edit Data/Business
  154.        '
  155.        CASE "1"
  156.          user_input = ""
  157.          count = 0
  158.          PRINT "@X0E Enter Data Phone Number.  Format: ###-###-#### (@X0F"
  159.          WHILE (1) DO
  160.            key = INKEY()
  161.            IF (key >= "0" && key <= "9") THEN
  162.              user_input = user_input + key
  163.              PRINT key
  164.              INC count
  165.              key = ""
  166.              IF (count = 12) BREAK
  167.              IF (count = 3 || count = 7) THEN
  168.                PRINT "-"
  169.                user_input = user_input + "-"
  170.                INC count
  171.              END IF
  172.            END IF
  173.            DELAY 3
  174.          END WHILE
  175.          a1 = user_input
  176.          COLOR @X07
  177.        '
  178.        '  Edit Home/Voice
  179.        '
  180.        CASE "2"
  181.          user_input = ""
  182.          count = 0
  183.          PRINT "@X0E Enter Voice Phone Number.  Format: ###-###-#### (@X0F"
  184.          WHILE (1) DO
  185.            key = INKEY()
  186.            IF (key >= "0" && key <= "9") THEN
  187.              user_input = user_input + key
  188.              PRINT key
  189.              INC count
  190.              key = ""
  191.              IF (count = 12) BREAK
  192.              IF (count = 3 || count = 7) THEN
  193.                PRINT "-"
  194.                user_input = user_input + "-"
  195.                INC count
  196.              END IF
  197.            END IF
  198.            DELAY 3
  199.          END WHILE
  200.          a2 = user_input
  201.          COLOR @X07
  202.        '
  203.        '  Exit and save information
  204.        '
  205.        CASE 3
  206.          '
  207.          '  Write information to user record variables and
  208.          '  write to the user record and end PPE
  209.          '
  210.          U_BDPHONE = a1
  211.          U_HVPHONE = a2
  212.          PUTUSER
  213.          PRINTLN "@X0F...Thank you @FIRST@, for completing the information...@X07"
  214.          NEWLINE
  215.          END
  216.      END SELECT
  217.      RETURN
  218.  
  219. '
  220. '  Display notice to user informing them of invalid phone number info
  221. '
  222. :DISPLAY_NOTICE
  223.  
  224.    PRINTLN "@X0E┌──────────────────────────────────────────────────@X0E┐"
  225.    PRINTLN "│@X0CWe have detected an error in the phone number(s)  @X0E│"
  226.    PRINTLN "│@X0Cyou entered as a new user.  Please correct any    @X0E│"
  227.    PRINTLN "│@X0Cinformation for the proper format.                @X0E│"
  228.    PRINTLN "│                                                  @X0E│"
  229.    PRINTLN "│@X0BChoose choice #3 to Exit and Save your corrections@X0E│"
  230.    PRINTLN "└──────────────────────────────────────────────────┘"
  231.    NEWLINE
  232.    RETURN
  233.